﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using Discuz.Config;
using Discuz.Web.Services.API.Actions;
using Discuz.Common;
using System.Reflection;
using Discuz.Web.Services.API;
using System.Web;
using System.Collections;
using System.Security.Cryptography;
using Discuz.Forum;
using Newtonsoft.Json;
using System.Data;
using Discuz.Entity;


namespace Discuz.Web.Services
{
    public class getTYUserJSON : Page
    {
        private static ErrorDetails _errorDetails = new ErrorDetails();
        public getTYUserJSON()
        {
            this.Load += new EventHandler(getTYUserJSON_Load);
        }

        void getTYUserJSON_Load(object sender, EventArgs e)
        {
            if (Request.Form["userCode"] == null)
            {
                return;
            }
            Response.Clear();
            Response.ContentType = "application/json";
            StringBuilder sb = new StringBuilder();
            try
            {
                string userCode = Request.Form["userCode"].ToString();
                string userName = Discuz.Forum.Users.GetTYUserNameByUserCode(userCode);

                sb.AppendLine("{");
                if (!string.IsNullOrEmpty(userName))
                {
                    sb.AppendFormat("'userCode':'{0}','userName':'{1}'", userCode, userName);
                }
                sb.AppendLine("}");
                Response.Write(sb.ToString());
            }
            catch (Exception ex)
            {
                Response.Write("0");
            }
            Response.End();

        }

    }
}
